package com.qf.service.serviceImpl;

import com.qf.dao.BookDao;
import com.qf.dao.daoImpl.BookDaoImpl;
import com.qf.entity.Book;
import com.qf.entity.Page;
import com.qf.service.BookService;

import java.util.List;

/**
 * @author 常肖飞先生
 * @version V1.0
 * @Project 0511_3
 * @Package com.qf.service.serviceImpl
 * @Description: book的serviceimpl
 * @Date 2022/5/12 10:59
 */
public class BookServiceimpl implements BookService {
    private BookDao bookDao = new BookDaoImpl();

    @Override
    public List<Book> selectAll() {
        List<Book> books = bookDao.selectAll();
        return books;
    }

    @Override
    public Boolean addBook(Book book) {
        return bookDao.addOneBook(book) > 0;
    }

    @Override
    public Boolean deleteOne(Integer bookId) {
        return  bookDao.delete(bookId)>0;
    }

    @Override
    public boolean updateBook(Integer id, Book book) {
        return bookDao.updateOneBook(id,book)>0;
    }

    @Override
    public int findAllPageCount() {
        return bookDao.selectAllByPageCount();
    }

    @Override
    public List<Book> findAllPage(Page page) {
        return bookDao.selectAllByPage(page);
    }
}
